package com.qing.common_result.controller;

import com.qing.common_result.result.CommonException;
import com.qing.common_result.result.ResponseResult;
import com.qing.common_result.result.ResultCode;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@ResponseResult
public class HelloController {


	@GetMapping("/getUserInfo")
	public Map<String, String> getUserInfo() {
		Map<String, String> result = new HashMap<>();
		result.put("name", "AAAA");
		result.put("age", "1");
		return result;
	}

	@GetMapping("/getNmae")
	public String getName() {
		String result = null;
		if (StringUtils.isEmpty(result)) {
			throw new CommonException(ResultCode.USER_NOT_LOGIN);
		}
		return result;

	}
}
